import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { Description, DescItem, useDescription } from '/@/components/Description/index';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '学号',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '姓名',
    align:"center",
    dataIndex: 'name'
   },
   {
     title: '部门',
     align:"center",
     dataIndex: 'departName'
    },
    {
     title: '学期',
     align:"center",
     dataIndex: 'semesterName'
    },
    {
      title: '课程主题',
      align:"center",
      dataIndex: 'themeName'
     },
    {
     title: '支付时间',
     align:"center",
     dataIndex: 'createTime'
    },
   {
    title: '商户订单号',
    align:"center",
    dataIndex: 'transactionId'
   }
];

export const approvalsCourseColumns: BasicColumn[] = [
  {
   title: '学号',
   align:"center",
   dataIndex: 'code'
  },
  {
   title: '姓名',
   align:"center",
   dataIndex: 'name'
  },
  {
    title: '部门',
    align:"center",
    dataIndex: 'departName'
   },
   {
    title: '学期',
    align:"center",
    dataIndex: 'semesterName'
   },
   {
    title: '课程主题',
    align:"center",
    dataIndex: 'themeName'
   },
   {
    title: '支付金额',
    align:"center",
    dataIndex: 'money'
   },
   {
    title: '支付时间',
    align:"center",
    dataIndex: 'createTime'
   }
  
];

export const searchApprovalsFormSchema: FormSchema[] = [
  {
    label: "学期",
    field: 'semesterId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"cs_semester where del_flag=0 and status=1 order by id desc,name,id"
    }
    },
  {
    label: '学号',
    field: 'code',
    component: 'Input',
   },
   {
    label: '姓名',
    field: 'name',
    component: 'Input',
   },
  {
   label: "支付时间",
   field: "createTime",
   component: 'RangePicker',
   componentProps: {
       valueType: 'Date',
   },
   //colProps: {span: 6},
},
{
  label: '部门',
  field: 'departName',
  component: 'JSelectDept',
  componentProps:{
    // checkStrictly:true,
    field:'deptId',
    multiple:false,
    params:{
      businessCode:1002
    }
  }
},
{
  label: "审批状态",
  field: 'nusubStatus',
  component: 'Input',
  defaultValue: 1,
  ifShow:false
  //colProps: {span: 6},
},
];


export const descItemCourseColumns: DescItem[] = [
  {
    label: '学号',
   field: 'code'
  },
  {
    label: '姓名',
   field: 'name'
  },
  {
    label: '部门',
    field: 'departName'
   },
   {
    label: '课程主题',
    field: 'themeName'
   },
   {
    label: '有效开始时间',
    field: 'beginDate'
   },
   {
    label: '有效结束时间',
    field: 'endDate'
   },
   {
    label: '支付金额',
    field: 'money'
   },
   {
    label: '创建时间',
    field: 'createTime'
   }
];





//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '部门',
    field: 'departName',
    component: 'JSelectDept',
    componentProps:{
      // checkStrictly:true,
      field:'deptId',
      multiple:false,
      params:{
        businessCode:1002
      }
    }
  },
  {
    label: "学期",
    field: 'semesterId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"cs_semester where del_flag=0 and status=1 order by id desc,name,id"
    }
    },
     {
      label: "支付时间",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date'
      },
      //colProps: {span: 6},
	},
  {
    label: "姓名",
    field: 'name',
    component: 'Input',
    //colProps: {span: 6},
 },
	{
      label: "学号",
      field: 'code',
      component: 'Input',
      //colProps: {span: 6},
 	}
   
/**{
  label: "审批状态",
  field: 'nusubStatus',
  component: 'Select',
  componentProps:{
    options:[{label:'正常',value:'0'},{label:'待审批',value:'1'},{label:'已退订',value:'2'}],
  }
},**/
];

export const purchOrderDetailcolumns: BasicColumn[] = [
  {
   title: 'id',
   align:"center",
   dataIndex: 'id',
   ifShow:false,
  },
  {
   title: '科目',
   align:"center",
   dataIndex: 'courseName'
  },
  {
   title: '科目费用',
   align:"center",
   dataIndex: 'money'
  },
  {
    title: '订单状态',
    align:"center",
    dataIndex: 'status',
    customRender:({text}) =>{
     return render.renderDict(text, 'subject_status');
   },
   }
];


export const detailcolumns: BasicColumn[] = [
  {
   title: 'id',
   align:"center",
   dataIndex: 'id',
   ifShow:false,
  },
  {
   title: '科目',
   align:"center",
   dataIndex: 'courseName'
  },
  {
   title: '科目费用',
   align:"center",
   dataIndex: 'money'
  },
  {
    title: '订单状态',
    align:"center",
    dataIndex: 'status',
    customRender:({text}) =>{
     return render.renderDict(text, 'subject_status');
   }
  },
   {
    title: '购买方式',
    align:"center",
    dataIndex: 'choseType',
    customRender:({text}) =>{
     return text=='1'?'选交':'必交';
   },
   },
   {
    title: '申请时间',
    align:"center",
    dataIndex: 'applydate'
   },
  {
   title: '审批状态',
   align:"center",
   dataIndex: 'nusubStatus',
   customRender:({text}) =>{
    return text=='0'?'正常':text=='1'?'待审批':'已退订';
  },

  },
  
];

export const searchQueryDetail :FormSchema[] = [
  ]
// 高级查询数据
export const superQuerySchema = {
  personId: {title: '购买人',order: 1,view: 'text', type: 'string',},
  unsubStatus: {title: '审批状态',order: 2,view: 'text', type: 'string',},
  ussubDate: {title: '审批时间',order: 3,view: 'datetime', type: 'string',},
  outTradeNo: {title: '商户订单号',order: 4,view: 'text', type: 'string',},
  money: {title: '支付金额',order: 5,view: 'number', type: 'number',},
  themeId: {title: '课程主题id',order: 6,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}